class ChangePwd extends React.Component {

    changePwd(){
        if(this.refs.newPwd1.value != this.refs.newPwd2.value){
            parent.layer.msg("密码不一致");
            return;
        }

        parent.layer.confirm("确认要修改密码么？",(index)=>{
            parent.layer.close(index);
            let param = {
                logPwd : this.refs.oldPwd.value,
                newPwd : this.refs.newPwd1.value,
                confirmPwd : this.refs.newPwd2.value
            };

            postJson("/LoginCtrl/changePw.x",$.param(param), function(data){
                parent.layer.alert(data.data);
            });
        })
    }

    render(){
        return(
            <Frame header="修改密码" >
                <Form type="pane">
                    <Item>
                        <Label>旧密码</Label>
                        <Input lay-verify="required" ref="oldPwd" type="password"/>
                    </Item>
                    <Item>
                        <Label>新密码</Label>
                        <Input lay-verify="required" ref="newPwd1" type="password"/>
                    </Item>
                    <Item>
                        <Label>确认新密码</Label>
                        <Input lay-verify="required" ref="newPwd2" type="password"/>
                    </Item>
                    <Button className="layui-btn layui-btn-normal" style={{marginLeft:110}} onClick={()=>this.changePwd()} lay-submit="true">确定</Button>
                </Form>
            </Frame>
        )
    }
}

ReactDOM.render(<ChangePwd/>,document.getElementById("changePwd"));